#include "logger.h"
#include <QFile>
#include <QCoreApplication>
#include <QTextStream>
#include <qdebug.h>

FLR_LOG qLog;

bool FLR_LOG::InitLog(const QString file)
{
    flr_file.setFileName(file);
    flr_file.open(QIODevice::WriteOnly);
    flr_stream.setDevice(&flr_file);

    WriteToLogDirect("<!DOCTYPE HTML>\n<html>");
    WriteToLogDirect("<head>\n\t<meta charset=\"utf-8\">\n\t<title>FLR Log Datei</title>\n\t<meta name=\"robots\" content=\"noindex,nofollow\">\n</head>\n<body>");
    return true;
}
bool FLR_LOG::ExitLog()
{
    // Datei schlie�en
    if(flr_file.isOpen())
    {
        WriteToLogDirect("</body>");
        WriteToLogDirect("</html>");

        flr_stream.flush();
        flr_stream.setDevice(NULL);
        flr_file.close();
    }

    return true;
}

bool FLR_LOG::WriteToLogDirect(const QString pcFormat)
{
    // String ins Logbuch schreiben
    if(flr_file.isOpen())
    {
        flr_stream << pcFormat << "<br>" << "\n";
        flr_stream.flush();

    }

    return true;
}
bool FLR_LOG::WriteToLog(const QString pcFormat)
{
    if(flr_file.isOpen())
    {
        flr_stream  << "<tr><td><font size=\"2\" color=\"#000080\">" << pcFormat <<  "</font></td></tr><br>" << "\n";
        flr_stream.flush();
    }
    return true;
}







